{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: pandas in c:\\users\\01\\anaconda3\\lib\\site-packages (0.24.2)\n",
      "Requirement already satisfied: numpy>=1.12.0 in c:\\users\\01\\anaconda3\\lib\\site-packages (from pandas) (1.20.1)\n",
      "Requirement already satisfied: pytz>=2011k in c:\\users\\01\\anaconda3\\lib\\site-packages (from pandas) (2019.1)\n",
      "Requirement already satisfied: python-dateutil>=2.5.0 in c:\\users\\01\\anaconda3\\lib\\site-packages (from pandas) (2.8.0)\n",
      "Requirement already satisfied: six>=1.5 in c:\\users\\01\\anaconda3\\lib\\site-packages (from python-dateutil>=2.5.0->pandas) (1.12.0)\n",
      "Requirement already satisfied: pyecharts in c:\\users\\01\\anaconda3\\lib\\site-packages (1.9.0)\n",
      "Requirement already satisfied: jinja2 in c:\\users\\01\\anaconda3\\lib\\site-packages (from pyecharts) (2.10.1)\n",
      "Requirement already satisfied: prettytable in c:\\users\\01\\anaconda3\\lib\\site-packages (from pyecharts) (2.1.0)\n",
      "Requirement already satisfied: simplejson in c:\\users\\01\\anaconda3\\lib\\site-packages (from pyecharts) (3.17.2)\n",
      "Requirement already satisfied: MarkupSafe>=0.23 in c:\\users\\01\\anaconda3\\lib\\site-packages (from jinja2->pyecharts) (1.1.1)\n",
      "Requirement already satisfied: wcwidth in c:\\users\\01\\anaconda3\\lib\\site-packages (from prettytable->pyecharts) (0.1.7)\n",
      "Requirement already satisfied: importlib-metadata; python_version < \"3.8\" in c:\\users\\01\\anaconda3\\lib\\site-packages (from prettytable->pyecharts) (0.17)\n",
      "Requirement already satisfied: zipp>=0.5 in c:\\users\\01\\anaconda3\\lib\\site-packages (from importlib-metadata; python_version < \"3.8\"->prettytable->pyecharts) (0.5.1)\n"
     ]
    }
   ],
   "source": [
    "!pip install pandas\n",
    "!pip install pyecharts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'echarts-wordcloud':'https://assets.pyecharts.org/assets/echarts-wordcloud.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"99079773653d43b7a2722cf8e1c9f69d\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', 'echarts-wordcloud'], function(echarts) {\n",
       "                var chart_99079773653d43b7a2722cf8e1c9f69d = echarts.init(\n",
       "                    document.getElementById('99079773653d43b7a2722cf8e1c9f69d'), 'white', {renderer: 'canvas'});\n",
       "                var option_99079773653d43b7a2722cf8e1c9f69d = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"wordCloud\",\n",
       "            \"shape\": \"circle\",\n",
       "            \"rotationRange\": [\n",
       "                -90,\n",
       "                90\n",
       "            ],\n",
       "            \"rotationStep\": 45,\n",
       "            \"girdSize\": 20,\n",
       "            \"sizeRange\": [\n",
       "                12,\n",
       "                60\n",
       "            ],\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u8463\\u5353\",\n",
       "                    \"value\": 54,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(107,107,150)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5218\\u5907\",\n",
       "                    \"value\": 4,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(150,73,96)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5415\\u5e03\",\n",
       "                    \"value\": 49,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(130,125,50)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u66f9\\u64cd\",\n",
       "                    \"value\": 41,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(138,52,12)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5173\\u7fbd\",\n",
       "                    \"value\": 5,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(92,67,10)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5f20\\u98de\",\n",
       "                    \"value\": 24,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(148,125,31)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4f55\\u8fdb\",\n",
       "                    \"value\": 33,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(134,39,83)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u97e9\\u5fe0\",\n",
       "                    \"value\": 7,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(139,74,19)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u674e\\u8083\",\n",
       "                    \"value\": 8,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(101,51,72)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9648\\u5bab\",\n",
       "                    \"value\": 7,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(95,16,75)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u516c\\u5b59\\u74d2\",\n",
       "                    \"value\": 12,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(109,82,122)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8881\\u7ecd\",\n",
       "                    \"value\": 34,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(36,158,121)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5f20\\u89d2\",\n",
       "                    \"value\": 16,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(121,9,66)\"\n",
       "                        }\n",
       "                    }\n",
       "                }\n",
       "            ],\n",
       "            \"drawOutOfBound\": false,\n",
       "            \"textStyle\": {\n",
       "                \"emphasis\": {}\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [],\n",
       "            \"selected\": {}\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    }\n",
       "};\n",
       "                chart_99079773653d43b7a2722cf8e1c9f69d.setOption(option_99079773653d43b7a2722cf8e1c9f69d);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1775cc93438>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#三国演义部分人名词云图\n",
    "from pyecharts.charts import WordCloud,Page\n",
    "\n",
    "key1 = ['董卓', '刘备', '吕布', '曹操','关羽','张飞','何进','韩忠','李肃','陈宫','公孙瓒','袁绍','张角']\n",
    "openfile = open('F:/数据可视化/实验/三国演义.txt', encoding='utf-8')\n",
    "readtxt = openfile.read()\n",
    "\n",
    "chapter6_start = \"第六回　焚金阙董卓行凶　匿玉玺孙坚背约\"\n",
    "charper1to5 = readtxt[:readtxt.find(chapter6_start)]\n",
    "WordCloud().add(\"\",\n",
    "               [(name,charper1to5.count(name)) for name in key1]).render_notebook()\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"74eb64353350497f981fb35fae9d8bb0\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_74eb64353350497f981fb35fae9d8bb0 = echarts.init(\n",
       "                    document.getElementById('74eb64353350497f981fb35fae9d8bb0'), 'white', {renderer: 'canvas'});\n",
       "                var option_74eb64353350497f981fb35fae9d8bb0 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"themeRiver\",\n",
       "            \"name\": [\n",
       "                \"\\u8463\\u5353\",\n",
       "                \"\\u5218\\u5907\",\n",
       "                \"\\u5415\\u5e03\",\n",
       "                \"\\u66f9\\u64cd\",\n",
       "                \"\\u5173\\u7fbd\",\n",
       "                \"\\u5f20\\u98de\",\n",
       "                \"\\u8881\\u7ecd\"\n",
       "            ],\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"1\",\n",
       "                    5,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"1\",\n",
       "                    1,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"1\",\n",
       "                    0,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"1\",\n",
       "                    1,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"1\",\n",
       "                    2,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"1\",\n",
       "                    9,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"1\",\n",
       "                    0,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"2\",\n",
       "                    2,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"2\",\n",
       "                    2,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"2\",\n",
       "                    0,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"2\",\n",
       "                    5,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"2\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"2\",\n",
       "                    8,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"2\",\n",
       "                    5,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"3\",\n",
       "                    16,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"3\",\n",
       "                    0,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"3\",\n",
       "                    10,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"3\",\n",
       "                    6,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"3\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"3\",\n",
       "                    0,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"3\",\n",
       "                    14,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"4\",\n",
       "                    18,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"4\",\n",
       "                    0,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"4\",\n",
       "                    4,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"4\",\n",
       "                    16,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"4\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"4\",\n",
       "                    0,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"4\",\n",
       "                    6,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"5\",\n",
       "                    13,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"5\",\n",
       "                    1,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"5\",\n",
       "                    35,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"5\",\n",
       "                    13,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"5\",\n",
       "                    3,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"5\",\n",
       "                    7,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"5\",\n",
       "                    9,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"6\",\n",
       "                    11,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"6\",\n",
       "                    0,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"6\",\n",
       "                    7,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"6\",\n",
       "                    7,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"6\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"6\",\n",
       "                    1,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"6\",\n",
       "                    11,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"7\",\n",
       "                    3,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"7\",\n",
       "                    1,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"7\",\n",
       "                    0,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"7\",\n",
       "                    0,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"7\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"7\",\n",
       "                    0,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"7\",\n",
       "                    21,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"8\",\n",
       "                    10,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"8\",\n",
       "                    0,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"8\",\n",
       "                    19,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"8\",\n",
       "                    0,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"8\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"8\",\n",
       "                    0,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"8\",\n",
       "                    0,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"9\",\n",
       "                    24,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"9\",\n",
       "                    0,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"9\",\n",
       "                    36,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"9\",\n",
       "                    0,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"9\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"9\",\n",
       "                    0,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"9\",\n",
       "                    0,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"10\",\n",
       "                    1,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"10\",\n",
       "                    0,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"10\",\n",
       "                    0,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"10\",\n",
       "                    16,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"10\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"10\",\n",
       "                    0,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"10\",\n",
       "                    2,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"11\",\n",
       "                    1,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"11\",\n",
       "                    9,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"11\",\n",
       "                    25,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"11\",\n",
       "                    26,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"11\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"11\",\n",
       "                    6,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"11\",\n",
       "                    2,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"12\",\n",
       "                    0,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"12\",\n",
       "                    2,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"12\",\n",
       "                    28,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"12\",\n",
       "                    20,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"12\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"12\",\n",
       "                    0,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"12\",\n",
       "                    0,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"13\",\n",
       "                    1,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"13\",\n",
       "                    0,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"13\",\n",
       "                    16,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"13\",\n",
       "                    7,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"13\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"13\",\n",
       "                    4,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"13\",\n",
       "                    2,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"14\",\n",
       "                    0,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"14\",\n",
       "                    9,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"14\",\n",
       "                    26,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"14\",\n",
       "                    23,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"14\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"14\",\n",
       "                    19,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"14\",\n",
       "                    1,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"15\",\n",
       "                    1,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"15\",\n",
       "                    4,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"15\",\n",
       "                    13,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"15\",\n",
       "                    1,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"15\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"15\",\n",
       "                    3,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"15\",\n",
       "                    1,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"16\",\n",
       "                    0,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"16\",\n",
       "                    15,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"16\",\n",
       "                    42,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"16\",\n",
       "                    8,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"16\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"16\",\n",
       "                    10,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"16\",\n",
       "                    1,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"17\",\n",
       "                    0,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"17\",\n",
       "                    3,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"17\",\n",
       "                    24,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"17\",\n",
       "                    8,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"17\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"17\",\n",
       "                    0,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"17\",\n",
       "                    0,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"18\",\n",
       "                    0,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"18\",\n",
       "                    1,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"18\",\n",
       "                    12,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"18\",\n",
       "                    14,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"18\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"18\",\n",
       "                    3,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"18\",\n",
       "                    4,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"19\",\n",
       "                    3,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"19\",\n",
       "                    0,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"19\",\n",
       "                    48,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"19\",\n",
       "                    21,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"19\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"19\",\n",
       "                    7,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"19\",\n",
       "                    1,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"20\",\n",
       "                    1,\n",
       "                    \"\\u8463\\u5353\"\n",
       "                ],\n",
       "                [\n",
       "                    \"20\",\n",
       "                    2,\n",
       "                    \"\\u5218\\u5907\"\n",
       "                ],\n",
       "                [\n",
       "                    \"20\",\n",
       "                    2,\n",
       "                    \"\\u5415\\u5e03\"\n",
       "                ],\n",
       "                [\n",
       "                    \"20\",\n",
       "                    8,\n",
       "                    \"\\u66f9\\u64cd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"20\",\n",
       "                    0,\n",
       "                    \"\\u5173\\u7fbd\"\n",
       "                ],\n",
       "                [\n",
       "                    \"20\",\n",
       "                    0,\n",
       "                    \"\\u5f20\\u98de\"\n",
       "                ],\n",
       "                [\n",
       "                    \"20\",\n",
       "                    0,\n",
       "                    \"\\u8881\\u7ecd\"\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u8463\\u5353\",\n",
       "                \"\\u5218\\u5907\",\n",
       "                \"\\u5415\\u5e03\",\n",
       "                \"\\u66f9\\u64cd\",\n",
       "                \"\\u5173\\u7fbd\",\n",
       "                \"\\u5f20\\u98de\",\n",
       "                \"\\u8881\\u7ecd\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u8463\\u5353\": true,\n",
       "                \"\\u5218\\u5907\": true,\n",
       "                \"\\u5415\\u5e03\": true,\n",
       "                \"\\u66f9\\u64cd\": true,\n",
       "                \"\\u5173\\u7fbd\": true,\n",
       "                \"\\u5f20\\u98de\": true,\n",
       "                \"\\u8881\\u7ecd\": true\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"axis\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"singleAxis\": {\n",
       "        \"bottom\": \"10%\",\n",
       "        \"type\": \"value\"\n",
       "    }\n",
       "};\n",
       "                chart_74eb64353350497f981fb35fae9d8bb0.setOption(option_74eb64353350497f981fb35fae9d8bb0);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1775cd36240>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#三国演义前20回人物频率变化\n",
    "import pyecharts.options as opts\n",
    "from pyecharts.charts import ThemeRiver\n",
    "import re\n",
    "names = ['董卓', '刘备', '吕布', '曹操','关羽','张飞','袁绍']\n",
    "openfile = open('F:/数据可视化/实验/三国演义.txt', encoding='utf-8')\n",
    "readtxt = openfile.read()\n",
    "\n",
    "chapter20_start = \"第二十一回　曹操煮酒论英雄　关公赚城斩车胄\"\n",
    "charper20 = readtxt[:readtxt.find(chapter20_start)]\n",
    "\n",
    "chapters = re.split(\"第.{1,3}回\", charper20)[1:]   #切分了章节\n",
    "id_chapters = enumerate(chapters)\n",
    "    \n",
    "data = []\n",
    "for x, chapter in id_chapters:\n",
    "    data.extend([[f\"{x+1}\",chapter.count(name),name] for name in names])\n",
    "#print(data)\n",
    "c = (\n",
    "        ThemeRiver()\n",
    "        .add(\n",
    "            names,\n",
    "            eval(repr(data)),\n",
    "            singleaxis_opts=opts.SingleAxisOpts(type_=\"value\",pos_bottom=\"10%\"),\n",
    "        )\n",
    ")\n",
    "c.render_notebook()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', '广西':'https://assets.pyecharts.org/assets/maps/guangxi'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"c78e20967e9049f792cf30d226db60e1\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', '广西'], function(echarts) {\n",
       "                var chart_c78e20967e9049f792cf30d226db60e1 = echarts.init(\n",
       "                    document.getElementById('c78e20967e9049f792cf30d226db60e1'), 'white', {renderer: 'canvas'});\n",
       "                var option_c78e20967e9049f792cf30d226db60e1 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"scatter\",\n",
       "            \"name\": \"geo1\",\n",
       "            \"coordinateSystem\": \"geo\",\n",
       "            \"symbolSize\": 12,\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u5357\\u5b81\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        108.37,\n",
       "                        22.82,\n",
       "                        2.21\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u67f3\\u5dde\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        109.42,\n",
       "                        24.33,\n",
       "                        1.86\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6842\\u6797\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        110.28,\n",
       "                        25.28,\n",
       "                        2.78\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u68a7\\u5dde\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        111.27,\n",
       "                        23.48,\n",
       "                        1.25\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5317\\u6d77\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        109.12,\n",
       "                        21.48,\n",
       "                        3.33\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9632\\u57ce\\u6e2f\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        108.35,\n",
       "                        21.7,\n",
       "                        6.17\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u94a6\\u5dde\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        108.62,\n",
       "                        21.95,\n",
       "                        1.08\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"scatter\",\n",
       "            \"name\": \"geo2\",\n",
       "            \"coordinateSystem\": \"geo\",\n",
       "            \"symbolSize\": 12,\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u8d35\\u6e2f\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        109.6,\n",
       "                        23.1,\n",
       "                        1.06\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7389\\u6797\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        110.17,\n",
       "                        22.63,\n",
       "                        1.28\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u767e\\u8272\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        106.62,\n",
       "                        23.9,\n",
       "                        3.62\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8d3a\\u5dde\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        111.55,\n",
       "                        24.42,\n",
       "                        1.18\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6cb3\\u6c60\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        108.07,\n",
       "                        24.7,\n",
       "                        3.35\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6765\\u5bbe\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        109.23,\n",
       "                        23.73,\n",
       "                        1.34\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5d07\\u5de6\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        107.37,\n",
       "                        22.4,\n",
       "                        1.74\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"geo1\",\n",
       "                \"geo2\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"geo1\": true,\n",
       "                \"geo2\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"formatter\": function (params) {        return params.name + ' : ' + params.value[2];    },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"Geo-\\u5e7f\\u897f\\u5730\\u56fe\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"visualMap\": {\n",
       "        \"show\": true,\n",
       "        \"type\": \"piecewise\",\n",
       "        \"min\": 1.06,\n",
       "        \"max\": 6.17,\n",
       "        \"inRange\": {\n",
       "            \"color\": [\n",
       "                \"#50a3ba\",\n",
       "                \"#eac763\",\n",
       "                \"#d94e5d\"\n",
       "            ]\n",
       "        },\n",
       "        \"calculable\": true,\n",
       "        \"inverse\": false,\n",
       "        \"splitNumber\": 5,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"showLabel\": true,\n",
       "        \"itemWidth\": 20,\n",
       "        \"itemHeight\": 14,\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"geo\": {\n",
       "        \"map\": \"\\u5e7f\\u897f\",\n",
       "        \"roam\": true,\n",
       "        \"aspectScale\": 0.75,\n",
       "        \"nameProperty\": \"name\",\n",
       "        \"selectedMode\": false,\n",
       "        \"emphasis\": {}\n",
       "    }\n",
       "};\n",
       "                chart_c78e20967e9049f792cf30d226db60e1.setOption(option_c78e20967e9049f792cf30d226db60e1);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1775c952320>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#广西地图数据分成两组各7个城市，用Geo方式画出图表。开启视觉通道，数值映射到大小，分段映射效果\n",
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Geo, Page\n",
    "from pyecharts.globals import ChartType, SymbolType,CurrentConfig\n",
    "CurrentConfig.ONLINE_HOST=\"https://assets.pyecharts.org/assets/\"\n",
    "\n",
    "districts = ['南宁市', '柳州市', '桂林市', '梧州市', '北海市', '防城港市', '钦州市', '贵港市', '玉林市', '百色市', '贺州市', '河池市', '来宾市', '崇左市']\n",
    "areas = [2.21, 1.86, 2.78, 1.25, 3.33, 6.17, 1.08, 1.06, 1.28, 3.62, 1.18, 3.35, 1.34, 1.74]\n",
    "\n",
    "c = (\n",
    "     Geo()\n",
    "        .add_schema(maptype= \"广西\")\n",
    "        .add(\"geo1\", [list(z) for z in zip(districts[:7], areas[:7])])\n",
    "        .add(\"geo2\", [list(z) for z in zip(districts[7:], areas[7:])])\n",
    "\n",
    "        .set_series_opts(label_opts=opts.LabelOpts(is_show=False))\n",
    "        .set_global_opts(\n",
    "            visualmap_opts=opts.VisualMapOpts(is_piecewise=True, max_=max(areas), min_ = min(areas)),\n",
    "            title_opts=opts.TitleOpts(title=\"Geo-广西地图\" ),\n",
    "        )\n",
    "    )\n",
    "c.render_notebook()\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'china':'https://assets.pyecharts.org/assets/maps/china'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"a84be879ee7345f4b8794ff8c1dfce3e\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', 'china'], function(echarts) {\n",
       "                var chart_a84be879ee7345f4b8794ff8c1dfce3e = echarts.init(\n",
       "                    document.getElementById('a84be879ee7345f4b8794ff8c1dfce3e'), 'white', {renderer: 'canvas'});\n",
       "                var option_a84be879ee7345f4b8794ff8c1dfce3e = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"white\",\n",
       "        \"white\",\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"effectScatter\",\n",
       "            \"coordinateSystem\": \"geo\",\n",
       "            \"showEffectOn\": \"render\",\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            },\n",
       "            \"symbolSize\": 12,\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u5357\\u5b81\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        108.37,\n",
       "                        22.82,\n",
       "                        2.21\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u67f3\\u5dde\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        109.42,\n",
       "                        24.33,\n",
       "                        1.86\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6842\\u6797\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        110.28,\n",
       "                        25.28,\n",
       "                        2.78\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u68a7\\u5dde\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        111.27,\n",
       "                        23.48,\n",
       "                        1.25\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5317\\u6d77\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        109.12,\n",
       "                        21.48,\n",
       "                        3.33\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9632\\u57ce\\u6e2f\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        108.35,\n",
       "                        21.7,\n",
       "                        6.17\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u94a6\\u5dde\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        108.62,\n",
       "                        21.95,\n",
       "                        1.08\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"lines\",\n",
       "            \"name\": \"\\u5e7f\\u897f14\\u5e02\",\n",
       "            \"coordinateSystem\": \"geo\",\n",
       "            \"zlevel\": 3,\n",
       "            \"progressive\": 400,\n",
       "            \"progressiveThreshold\": 3000,\n",
       "            \"effect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4,\n",
       "                \"color\": \"blue\",\n",
       "                \"symbol\": \"arrow\",\n",
       "                \"symbolSize\": 6\n",
       "            },\n",
       "            \"symbol\": [\n",
       "                \"none\",\n",
       "                \"arrow\"\n",
       "            ],\n",
       "            \"polyline\": false,\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 2000,\n",
       "            \"symbolSize\": 12,\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u94a6\\u5dde\\u5e02->\\u5357\\u5b81\\u5e02\",\n",
       "                    \"coords\": [\n",
       "                        [\n",
       "                            108.62,\n",
       "                            21.95\n",
       "                        ],\n",
       "                        [\n",
       "                            108.37,\n",
       "                            22.82\n",
       "                        ]\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u94a6\\u5dde\\u5e02->\\u67f3\\u5dde\\u5e02\",\n",
       "                    \"coords\": [\n",
       "                        [\n",
       "                            108.62,\n",
       "                            21.95\n",
       "                        ],\n",
       "                        [\n",
       "                            109.42,\n",
       "                            24.33\n",
       "                        ]\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u94a6\\u5dde\\u5e02->\\u6842\\u6797\\u5e02\",\n",
       "                    \"coords\": [\n",
       "                        [\n",
       "                            108.62,\n",
       "                            21.95\n",
       "                        ],\n",
       "                        [\n",
       "                            110.28,\n",
       "                            25.28\n",
       "                        ]\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u94a6\\u5dde\\u5e02->\\u68a7\\u5dde\\u5e02\",\n",
       "                    \"coords\": [\n",
       "                        [\n",
       "                            108.62,\n",
       "                            21.95\n",
       "                        ],\n",
       "                        [\n",
       "                            111.27,\n",
       "                            23.48\n",
       "                        ]\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u94a6\\u5dde\\u5e02->\\u5317\\u6d77\\u5e02\",\n",
       "                    \"coords\": [\n",
       "                        [\n",
       "                            108.62,\n",
       "                            21.95\n",
       "                        ],\n",
       "                        [\n",
       "                            109.12,\n",
       "                            21.48\n",
       "                        ]\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u94a6\\u5dde\\u5e02->\\u9632\\u57ce\\u6e2f\\u5e02\",\n",
       "                    \"coords\": [\n",
       "                        [\n",
       "                            108.62,\n",
       "                            21.95\n",
       "                        ],\n",
       "                        [\n",
       "                            108.35,\n",
       "                            21.7\n",
       "                        ]\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0.2,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"effectScatter\",\n",
       "            \"coordinateSystem\": \"geo\",\n",
       "            \"showEffectOn\": \"render\",\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            },\n",
       "            \"symbolSize\": 12,\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u8d35\\u6e2f\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        109.6,\n",
       "                        23.1,\n",
       "                        1.06\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7389\\u6797\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        110.17,\n",
       "                        22.63,\n",
       "                        1.28\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u767e\\u8272\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        106.62,\n",
       "                        23.9,\n",
       "                        3.62\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8d3a\\u5dde\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        111.55,\n",
       "                        24.42,\n",
       "                        1.18\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6cb3\\u6c60\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        108.07,\n",
       "                        24.7,\n",
       "                        3.35\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6765\\u5bbe\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        109.23,\n",
       "                        23.73,\n",
       "                        1.34\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5d07\\u5de6\\u5e02\",\n",
       "                    \"value\": [\n",
       "                        107.37,\n",
       "                        22.4,\n",
       "                        1.74\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"lines\",\n",
       "            \"coordinateSystem\": \"geo\",\n",
       "            \"zlevel\": 5,\n",
       "            \"progressive\": 400,\n",
       "            \"progressiveThreshold\": 3000,\n",
       "            \"effect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4,\n",
       "                \"color\": \"blue\",\n",
       "                \"symbol\": \"arrow\",\n",
       "                \"symbolSize\": 6\n",
       "            },\n",
       "            \"symbol\": [\n",
       "                \"none\",\n",
       "                \"arrow\"\n",
       "            ],\n",
       "            \"polyline\": false,\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 2000,\n",
       "            \"symbolSize\": 12,\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u8d35\\u6e2f\\u5e02->\\u7389\\u6797\\u5e02\",\n",
       "                    \"coords\": [\n",
       "                        [\n",
       "                            109.6,\n",
       "                            23.1\n",
       "                        ],\n",
       "                        [\n",
       "                            110.17,\n",
       "                            22.63\n",
       "                        ]\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8d35\\u6e2f\\u5e02->\\u767e\\u8272\\u5e02\",\n",
       "                    \"coords\": [\n",
       "                        [\n",
       "                            109.6,\n",
       "                            23.1\n",
       "                        ],\n",
       "                        [\n",
       "                            106.62,\n",
       "                            23.9\n",
       "                        ]\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8d35\\u6e2f\\u5e02->\\u8d3a\\u5dde\\u5e02\",\n",
       "                    \"coords\": [\n",
       "                        [\n",
       "                            109.6,\n",
       "                            23.1\n",
       "                        ],\n",
       "                        [\n",
       "                            111.55,\n",
       "                            24.42\n",
       "                        ]\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8d35\\u6e2f\\u5e02->\\u6cb3\\u6c60\\u5e02\",\n",
       "                    \"coords\": [\n",
       "                        [\n",
       "                            109.6,\n",
       "                            23.1\n",
       "                        ],\n",
       "                        [\n",
       "                            108.07,\n",
       "                            24.7\n",
       "                        ]\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8d35\\u6e2f\\u5e02->\\u6765\\u5bbe\\u5e02\",\n",
       "                    \"coords\": [\n",
       "                        [\n",
       "                            109.6,\n",
       "                            23.1\n",
       "                        ],\n",
       "                        [\n",
       "                            109.23,\n",
       "                            23.73\n",
       "                        ]\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8d35\\u6e2f\\u5e02->\\u5d07\\u5de6\\u5e02\",\n",
       "                    \"coords\": [\n",
       "                        [\n",
       "                            109.6,\n",
       "                            23.1\n",
       "                        ],\n",
       "                        [\n",
       "                            107.37,\n",
       "                            22.4\n",
       "                        ]\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0.2,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\",\n",
       "                \"\\u5e7f\\u897f14\\u5e02\",\n",
       "                \"\",\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\": true,\n",
       "                \"\\u5e7f\\u897f14\\u5e02\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"formatter\": function (params) {        return params.name + ' : ' + params.value[2];    },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"Geo-Lines-background\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"geo\": {\n",
       "        \"map\": \"china\",\n",
       "        \"roam\": true,\n",
       "        \"aspectScale\": 0.75,\n",
       "        \"nameProperty\": \"name\",\n",
       "        \"selectedMode\": false,\n",
       "        \"itemStyle\": {\n",
       "            \"color\": \"#323c48\",\n",
       "            \"borderColor\": \"#111\"\n",
       "        },\n",
       "        \"emphasis\": {}\n",
       "    }\n",
       "};\n",
       "                chart_a84be879ee7345f4b8794ff8c1dfce3e.setOption(option_a84be879ee7345f4b8794ff8c1dfce3e);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1775c96bb00>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#广西地图数据，分成两组各7个城市，用Geo方式画出图表。开启视觉通道，数值映射到大小，分段映射效果\n",
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Geo\n",
    "from pyecharts.globals import ChartType, SymbolType\n",
    "\n",
    "c = (\n",
    "    Geo()\n",
    "    .add_schema(\n",
    "        maptype=\"china\",\n",
    "        itemstyle_opts=opts.ItemStyleOpts(color=\"#323c48\", border_color=\"#111\"),\n",
    "    )\n",
    "    .add(\n",
    "        \"\",\n",
    "        [(\"南宁市\", 2.21), (\"柳州市\", 1.86), (\"桂林市\",2.78), (\"梧州市\", 1.25), (\"北海市\", 3.33), (\"防城港市\",6.17), (\"钦州市\", 1.08)],\n",
    "        type_=ChartType.EFFECT_SCATTER,\n",
    "        color=\"white\",\n",
    "    )\n",
    "    .add(\n",
    "        \"广西14市\",\n",
    "        [(\"钦州市\", \"南宁市\"), (\"钦州市\", \"柳州市\"), (\"钦州市\", \"桂林市\"), (\"钦州市\", \"梧州市\"),(\"钦州市\", \"北海市\"), (\"钦州市\", \"防城港市\")],\n",
    "        type_=ChartType.LINES,\n",
    "        effect_opts=opts.EffectOpts(\n",
    "            symbol=SymbolType.ARROW, symbol_size=6, color=\"blue\"\n",
    "        ),\n",
    "        linestyle_opts=opts.LineStyleOpts(curve=0.2),\n",
    "    )\n",
    "    .add(\n",
    "        \"\",\n",
    "        [(\"贵港市\", 1.06), (\"玉林市\", 1.28), (\"百色市\",3.62), (\"贺州市\", 1.18), (\"河池市\", 3.35), (\"来宾市\",1.34), (\"崇左市\", 1.74)],\n",
    "        type_=ChartType.EFFECT_SCATTER,\n",
    "        color=\"white\",\n",
    "    )\n",
    "    .add(\n",
    "        \"\",\n",
    "        [(\"贵港市\", \"玉林市\"), (\"贵港市\", \"百色市\"), (\"贵港市\", \"贺州市\"), (\"贵港市\", \"河池市\"),(\"贵港市\", \"来宾市\"), (\"贵港市\", \"崇左市\")],\n",
    "        type_=ChartType.LINES,\n",
    "        effect_opts=opts.EffectOpts(\n",
    "            symbol=SymbolType.ARROW, symbol_size=6, color=\"blue\"\n",
    "        ),\n",
    "        linestyle_opts=opts.LineStyleOpts(curve=0.2),\n",
    "    )\n",
    "    .set_series_opts(label_opts=opts.LabelOpts(is_show=False))\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"Geo-Lines-background\"))\n",
    "   \n",
    ")\n",
    "c.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', '广西':'https://assets.pyecharts.org/assets/maps/guangxi'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"a114c76354614433b80188d347bd3835\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', '广西'], function(echarts) {\n",
       "                var chart_a114c76354614433b80188d347bd3835 = echarts.init(\n",
       "                    document.getElementById('a114c76354614433b80188d347bd3835'), 'white', {renderer: 'canvas'});\n",
       "                var option_a114c76354614433b80188d347bd3835 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"map\",\n",
       "            \"name\": \"geo1\",\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"mapType\": \"\\u5e7f\\u897f\",\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u5357\\u5b81\\u5e02\",\n",
       "                    \"value\": 2.21\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u67f3\\u5dde\\u5e02\",\n",
       "                    \"value\": 1.86\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6842\\u6797\\u5e02\",\n",
       "                    \"value\": 2.78\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u68a7\\u5dde\\u5e02\",\n",
       "                    \"value\": 1.25\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5317\\u6d77\\u5e02\",\n",
       "                    \"value\": 3.33\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9632\\u57ce\\u6e2f\\u5e02\",\n",
       "                    \"value\": 6.17\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u94a6\\u5dde\\u5e02\",\n",
       "                    \"value\": 1.08\n",
       "                }\n",
       "            ],\n",
       "            \"roam\": true,\n",
       "            \"aspectScale\": 0.75,\n",
       "            \"nameProperty\": \"name\",\n",
       "            \"selectedMode\": false,\n",
       "            \"zoom\": 1,\n",
       "            \"mapValueCalculation\": \"sum\",\n",
       "            \"showLegendSymbol\": true,\n",
       "            \"emphasis\": {},\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"map\",\n",
       "            \"name\": \"geo2\",\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"mapType\": \"\\u5e7f\\u897f\",\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u8d35\\u6e2f\\u5e02\",\n",
       "                    \"value\": 1.06\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7389\\u6797\\u5e02\",\n",
       "                    \"value\": 1.28\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u767e\\u8272\\u5e02\",\n",
       "                    \"value\": 3.62\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8d3a\\u5dde\\u5e02\",\n",
       "                    \"value\": 1.18\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6cb3\\u6c60\\u5e02\",\n",
       "                    \"value\": 3.35\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6765\\u5bbe\\u5e02\",\n",
       "                    \"value\": 1.34\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5d07\\u5de6\\u5e02\",\n",
       "                    \"value\": 1.74\n",
       "                }\n",
       "            ],\n",
       "            \"roam\": true,\n",
       "            \"aspectScale\": 0.75,\n",
       "            \"nameProperty\": \"name\",\n",
       "            \"selectedMode\": false,\n",
       "            \"zoom\": 1,\n",
       "            \"mapValueCalculation\": \"sum\",\n",
       "            \"showLegendSymbol\": true,\n",
       "            \"emphasis\": {},\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"geo1\",\n",
       "                \"geo2\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"geo1\": true,\n",
       "                \"geo2\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"Map-\\u5e7f\\u897f\\u5730\\u56fe\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"visualMap\": {\n",
       "        \"show\": true,\n",
       "        \"type\": \"piecewise\",\n",
       "        \"min\": 1.06,\n",
       "        \"max\": 6.17,\n",
       "        \"inRange\": {\n",
       "            \"color\": [\n",
       "                \"#50a3ba\",\n",
       "                \"#eac763\",\n",
       "                \"#d94e5d\"\n",
       "            ]\n",
       "        },\n",
       "        \"calculable\": true,\n",
       "        \"inverse\": false,\n",
       "        \"splitNumber\": 5,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"showLabel\": true,\n",
       "        \"itemWidth\": 20,\n",
       "        \"itemHeight\": 14,\n",
       "        \"borderWidth\": 0\n",
       "    }\n",
       "};\n",
       "                chart_a114c76354614433b80188d347bd3835.setOption(option_a114c76354614433b80188d347bd3835);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1775c9983c8>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#2）分成两组各7个城市，用Map方式画出图表。开启视觉通道，数值映射到颜色，连续映射效果\n",
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Map\n",
    "\n",
    "districts = ['南宁市', '柳州市', '桂林市', '梧州市', '北海市', '防城港市', '钦州市', '贵港市', '玉林市', '百色市', '贺州市', '河池市', '来宾市', '崇左市']\n",
    "areas = [2.21, 1.86, 2.78, 1.25, 3.33, 6.17, 1.08, 1.06, 1.28, 3.62, 1.18, 3.35, 1.34, 1.74]\n",
    "\n",
    "c = (\n",
    "    Map()\n",
    "      \n",
    "        .add(\"geo1\", [list(z) for z in zip(districts[:7], areas[:7])],\"广西\")\n",
    "        .add(\"geo2\", [list(z) for z in zip(districts[7:], areas[7:])],\"广西\")\n",
    "\n",
    "        .set_series_opts(label_opts=opts.LabelOpts(is_show=False))\n",
    "        .set_global_opts(\n",
    "            visualmap_opts=opts.VisualMapOpts(is_piecewise=True, max_=max(areas), min_ = min(areas)),\n",
    "            title_opts=opts.TitleOpts(title=\"Map-广西地图\" ),\n",
    "        )\n",
    "    )\n",
    "c.render_notebook()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
